#include once "mud-gui/ui.bi"
#include once "mud-gui/gclass.bi"
#include once "mud-gui/util.bi"
#include once "mud-gui/event.bi"
#include once "mud-gui/widgets/basewidget.bi"

#inclib "mudgui-stdwidgets"

namespace ui

gclass(GridLayout)

	declare constructor ( byval parent as BaseWidget ptr = 0, byval grid_x as ubyte = 0, byval grid_y as ubyte = 0 )
	
	DEF_PROPERTY(bgColor,uinteger)
	
	declare sub sizeGrid( byval grid_x as integer, byval grid_y as integer )
	
	'returns false (0) if widget overlaps another one in the grid.
	'if the widget is not already a child of this widget it reparents it
	'if the widget is already a child it sets its location in the grid.
	'if the widget overlaps another one it is not reparented or added.
	'to add a widget to a single "box" just use the one coordinate pair
	'to set the widget to take up multiple spaces in the grid use 2 pairs
	declare function PlaceWidget( byval wid as BaseWidget ptr, byval x as integer, byval y as integer, _
									byval x2 as integer = 0, byval y2 as integer = 0) as integer
	
	'signals
	declare STATIC_SLOT(Destroy)
	declare STATIC_SLOT(PaintEvent)
	declare STATIC_SLOT(resize_handler)
	
	as ubyte ptr m_grid
	as ubyte m_x, m_y
	as integer m_hpix, m_ypix
	
endgclass


end namespace
